<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('货物报关信息维护-编辑')" />
	<th:block th:include="include :: businessCSS" />
	<style>
		.preservationBtn{padding: 10px;text-align: center;}
		.preservationBtn input{font-size: 16px;background-color: rgb(80, 138, 238);color: #fff;border: none;padding: 5px 30px;border-radius: 10px;cursor: pointer;}
	</style>

</head>

<body class="no-skin">

<div class="main-container" id="main-container">
	<div class="main-content">
		<form class="layui-form head-form">
			<div class="north" style="background-color: #fff;">
				<div class="forminput"></div>
				<div class="layui-form-item preservationBtn">
					<input type="button" lay-submit lay-filter="btn-add" id="btn-add" value="保存">
				</div>
			</div>
		</form>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<th:block th:include="include :: inlineJS" />

<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + "storage/tsCargomaintenance";
	var	k_fields=[]
	var fields = [[${fields}]];
	var fieldsList = [[${fieldsList}]];
	var fieldsHiddenList = [[${fieldsHiddenList}]];
	var all_fields= fieldsList;
	var $,layer,form,table;
	var enableEdit = [[${enableEdit}]];
	layui.use(['laydate','form','layer','jquery','util','element','upload','table'], function () {
		$ = layui.$,layer = layui.layer,form = layui.form,laydate = layui.laydate,util = layui.util,element=layui.element,upload = layui.upload;
		headcom3()

		form.on('submit(btn-add)', function(data){
			var is_return = false//是否中断保存
			fieldsList.map((v,i)=>{
				if(v.fieldFrontRequired){
					if(!$('#'+v.fields).val()){
						layer.msg(v.fieldName+'不能为空')
						is_return=true
					}
				}
			})
			if(is_return) return;
			$.modal.loading("正在处理中，请稍后...");
			$.post("/storage/tsCargomaintenance/editpost",{infoMap:JSON.stringify(data.field)},function(res){
				$.modal.closeLoading()
				layer.msg(res.msg);
				if (res.code == 0){
					setTimeout(function(){
						window.location.href = '/storage/tsCargomaintenance/edit?guid=' + res.data;
					}, 1000);
				}
			});
			return false;
		});
	});

</script>

</body>
</html>